@import cn.hutool.core.date.DateUtil
@import cn.hutool.core.text.NamingCase
@import cn.hutool.core.util.StrUtil
@import com.example.codeger.jimmer.JimmerEntitySourceBuilder
@import com.example.config.Jdbc2Java
@import java.sql.JDBCType
@param  JimmerEntitySourceBuilder.JimmerEntitySourceData  jimmerEntitySourceData
package ${jimmerEntitySourceData.getPackages_v()};

@for( var impCls : jimmerEntitySourceData.getImports())
    import ${impCls};
@endfor

/**
* ${jimmerEntitySourceData.getTableInfo().getComment()}
* gen at ${DateUtil.now()}
*  jte 模板缺点 循环中不好控制空白行
*有语法校验  但有时都是括号无法识别 有idea插件支持
*/
@Entity
@Table(name = "${jimmerEntitySourceData.getTableName()}")
<%//类名转大驼峰 toPascalCase %>
public interface ${NamingCase.toPascalCase(jimmerEntitySourceData.getTableInfo().getTableName())} {
@for( var column : jimmerEntitySourceData.getTableInfo().getColumns())
    !{
        String  columndatatype ="";
        Jdbc2Java.Jdbc2JavaEnum jdbc2JavaEnum = Jdbc2Java.Jdbc2JavaEnum.getJdbc2JavaEnum(column.getType());
        if (null==jdbc2JavaEnum){
            throw new RuntimeException("未知的列类型");
        }
        if (column.isNullable() && StrUtil.equals(jdbc2JavaEnum.getJavaTypeNull(),jdbc2JavaEnum.getJavaTypeNotNull())  ) {
            columndatatype=jdbc2JavaEnum.getJavaTypeNull();
        }else{
            columndatatype=jdbc2JavaEnum.getJavaTypeNotNull();
        }
    }
    @if(column.getComment() !=null)
        /**
        * ${column.getComment()}
        */
    @endif
    @if(column.isNullable() && StrUtil.equals(jdbc2JavaEnum.getJavaTypeNull(),jdbc2JavaEnum.getJavaTypeNotNull()))
        @Nullable
    @endif
    @if(column.isPk())
        @Id
    @endif
    @Column(name = "${column.getName()}", sqlType = "${JDBCType.valueOf(column.getType())}")
    ${columndatatype} ${NamingCase.toCamelCase(column.getName())}();
@endfor

}
